//
//  MKChainedClassError.m
//  ObjectCChained
//
//  Created by sny on 2018/5/21.
//  Copyright © 2018年 HuangYangYang. All rights reserved.
//

#import "MKChainedClassError.h"

@implementation MKChainedClassError

#pragma mark - setter

- (void)setClassErrorType:(MKChainedClassErrorType)classErrorType {
    _classErrorType = classErrorType;
    switch (classErrorType) {
        case MKChainedClassErrorKey:
        {
            NSLog(@"The key of errors exist in the dictionary");
        }
            break;
        case MKChainedClassErrorValue:
        {
            NSLog(@"The value of errors exist in the dictionary");
        }
            break;
        case MKChainedClassErrorCrossing:
        {
            NSLog(@"Quantity does not conform to the array and the number of attributes");
        }
            break;
        case MKChainedClassErrorInvalid:
        {
            NSLog(@"Initialization of the parameters is not correct");
        }
            break;
        default:
        {
            NSLog(@"An unknown error");
        }
            break;
    }
}

+ (void)showErrorWithMKChainedClassErrorType:(MKChainedClassErrorType)classErrorType {
    switch (classErrorType) {
        case MKChainedClassErrorKey:
        {
            NSLog(@"The key of errors exist in the dictionary");
        }
            break;
        case MKChainedClassErrorValue:
        {
            NSLog(@"The value of errors exist in the dictionary");
        }
            break;
        case MKChainedClassErrorCrossing:
        {
            NSLog(@"Quantity does not conform to the array and the number of attributes");
        }
            break;
        case MKChainedClassErrorInvalid:
        {
            NSLog(@"Initialization of the parameters is not correct");
        }
            break;
        default:
        {
            NSLog(@"An unknown error");
        }
            break;
    }
}

+ (void)showErrorWithMKChainedClassErrorType:(MKChainedClassErrorType)classErrorType
                              WithErrorValue:(NSString *)errorValue {
    //本方法中只处理了字典的key值问题
    switch (classErrorType) {
        case MKChainedClassErrorKey:
        {
            NSLog(@"The key of errors exist in the dictionary -> %@",errorValue);
        }
            break;
        case MKChainedClassErrorValue:
        {
            NSLog(@"The value of errors exist in the dictionary -> %@",errorValue);
        }
            break;
        case MKChainedClassErrorCrossing:
        {
            NSLog(@"Quantity does not conform to the array and the number of attributes");
        }
            break;
        case MKChainedClassErrorInvalid:
        {
            NSLog(@"Initialization of the parameters is not correct");
        }
            break;
        default:
        {
            NSLog(@"An unknown error");
        }
            break;
    }
}

+ (void)showErrrorPropertyName:(NSString *)propertyName
           ErrorParamsProperty:(NSString *)errorType
             CorrectParamsName:(NSString *)correctType {
    NSString *errorMessage = [NSString stringWithFormat:@"errorcode : 1004 , %@ : %@ <-  %@",propertyName,correctType,errorType];
    NSAssert([errorType isEqualToString:correctType], errorMessage);
}

- (MKChainedClassErrorType)getMKChainedClassErrorType {
    return _classErrorType;
}

@end
